#include <stdio.h>
#include "graph.h"

int main(void)
{
	Graph graph;

	Init(&graph);

	for (char i = 'A'; i <= 'F'; i++)
		InsertVertex(&graph, i);

	InsertEdge(&graph, 'A', 'B');
	InsertEdge(&graph, 'A', 'D');
	InsertEdge(&graph, 'A', 'C');
	InsertEdge(&graph, 'C', 'B');
	InsertEdge(&graph, 'C', 'E');
	InsertEdge(&graph, 'D', 'E');
	InsertEdge(&graph, 'F', 'D');
	InsertEdge(&graph, 'F', 'E');
	// Show(&graph);

	int ret = TopologicalSort(&graph);
	if (ret == -1)
		fprintf(stderr, "malloc failed!\n");
	else if (ret == -2)
		fprintf(stderr, "图中有环\n");

	return 0;
}
